perf(bagel): batch trainside UniGRPO rollout forwards - #253
Draft
CjhHa1 wants to merge 2 commits into
Draft
Conversation
Pack independent AR chains and same-shape diffusion samples block-diagonally to amortize live-FSDP all-gathers while preserving the serial path as the default.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
forward_batch_size=1behavior and RNG semantics unchanged by defaultMotivation
BAGEL unified full-FT spends about 76% of a G=4 probe step in generation; at the production G=24 fanout this is expected to approach 90–95%. The current trainside path executes each sibling with navit batch size one and repeats live-FSDP all-gathers.
Fresh 8×H20 full-FT A/B
Identical config for all arms:
batch_size=8,samples_per_prompt=4,max_new_tokens=512, two rollouts, no checkpoint save. Steady time is the rollout-1 → rollout-2 timestamp delta.Pack-4 captures almost all of the gain and is the safer memory-tuning recommendation; the committed default remains 1.
Test plan
7 passed)forward_batch_size=1keeps the legacy no-generator path1.0000±0.0000Historical prototype reference: 2×8 steady step improved from ~267s to ~132s; this PR is a clean port onto current main/KV conditions rather than a rebase of that stale branch.
Maintainer validation (347a22e)
The seven focused
test_pack_bcases passed before the PR-added test file was removed per repository preference. Notests/**addition remains in the PR.compileall, full pre-commit, and recipe target resolution pass on the current head. Runtime risk remains moderate/high despite the opt-in default because the packed BAGEL path changes model execution and has only the author hardware A/B evidence.